/*
Copyright 2007 Luke Benstead

This file is part of slMath.

slMath is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

slMath is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser Public License for more details.

You should have received a copy of the GNU Lesser Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef MAT4_H_INCLUDED
#define MAT4_H_INCLUDED

#ifdef USE_DOUBLE_PRECISION
	typedef double slScalar;
#else
	typedef float slScalar;
#endif

struct slVec3;
struct slQuaternion;

struct slMat4{
	slScalar m_Mat[16];
};

slMat4* slMat4Identity(slMat4* pOut);
slMat4* slMat4Inverse(slMat4* pOut, slScalar* pDeterminate, const slMat4* pM);
bool  slMat4IsIdentity(const slMat4* pIn);
slMat4* slMat4Transpose(slMat4* pOut, const slMat4* pIn);
slMat4* slMat4Multiply(slMat4* pOut, const slMat4* pM1, const slMat4* pM2);
slMat4* slMat4MultiplyTranspose(slMat4* pOut, const slMat4* pM1, const slMat4* pM2);

slMat4* slMat4Assign(slMat4* pOut, const slMat4* pIn);
bool  slMat4AreEqual(const slMat4* pM1, const slMat4* pM2);

slMat4* slMat4RotationAxis(slMat4* pOut, const slVec3 pAxis, slScalar radians);
slMat4* slMat4RotationX(slMat4* pOut, const float radians);
slMat4* slMat4RotationY(slMat4* pOut, const float radians);
slMat4* slMat4RotationZ(slMat4* pOut, const float radians);
slMat4* slMat4RotationPitchYawRoll(slMat4* pOut, const slScalar pitch, const slScalar yaw, const slScalar roll);
slMat4* slMat4RotationQuaternion(slMat4* pOut, const slQuaternion* pQ);
slMat4* slMat4Scaling(slMat4* pOut, const slScalar x, const slScalar y, const slScalar z);
slMat4* slMat4Translation(slMat4* pOut, const slScalar x, const slScalar y, const slScalar z);

slVec3* slMat4GetUpVec3(slVec3* pOut, const slMat4* pIn);
slVec3* slMat4GetRightVec3(slVec3* pOut, const slMat4* pIn);
slVec3* slMat4GetForwardVec3(slVec3* pOut, const slMat4* pIn);

#endif // MAT4_H_INCLUDED
